import 'package:flutter_admin/utils/utils.dart';

class SaleBidMarketinfo {
  String? id;
  String? projectId;
  String? isdesignated;
  String? interestedbidder;
  String? registeredlist;
  String? customerrelationship;
  String? qualitycontrol;
  String? orientation;
  String? lasttender;
  String? competitor;
  String? evaluationcommittee;
  String? sampledelivery;
  String? precautions;
  String? guidance;
  String? tenderform;
  String? others;
  String? createUid;
  String? createDate;
  String? writeUid;
  String? writeDate;

  SaleBidMarketinfo({
    this.id,
    this.projectId,
    this.isdesignated,
    this.interestedbidder,
    this.registeredlist,
    this.customerrelationship,
    this.qualitycontrol,
    this.orientation,
    this.lasttender,
    this.competitor,
    this.evaluationcommittee,
    this.sampledelivery,
    this.precautions,
    this.guidance,
    this.tenderform,
    this.others,
    this.createUid,
    this.createDate,
    this.writeUid,
    this.writeDate,
  });

  SaleBidMarketinfo copyWith({
    String? id,
    String? isdesignated,
    String? interestedbidder,
    String? registeredlist,
    String? customerrelationship,
    String? qualitycontrol,
    String? orientation,
    String? lasttender,
    String? competitor,
    String? evaluationcommittee,
    String? sampledelivery,
    String? precautions,
    String? guidance,
    String? tenderform,
    String? others,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
  }) {
    return new SaleBidMarketinfo(
      id: id ?? this.id,
      isdesignated: isdesignated ?? this.isdesignated,
      interestedbidder: interestedbidder ?? this.interestedbidder,
      registeredlist: registeredlist ?? this.registeredlist,
      customerrelationship: customerrelationship ?? this.customerrelationship,
      qualitycontrol: qualitycontrol ?? this.qualitycontrol,
      orientation: orientation ?? this.orientation,
      lasttender: lasttender ?? this.lasttender,
      competitor: competitor ?? this.competitor,
      evaluationcommittee: evaluationcommittee ?? this.evaluationcommittee,
      sampledelivery: sampledelivery ?? this.sampledelivery,
      precautions: precautions ?? this.precautions,
      guidance: guidance ?? this.guidance,
      tenderform: tenderform ?? this.tenderform,
      others: others ?? this.others,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
    );
  }

  @override
  String toString() {
    return '''SaleBidMarketinfo{
      id: $id,
      projectId: $projectId,
      isdesignated: $isdesignated,
      interestedbidder: $interestedbidder,
      registeredlist: $registeredlist,
      customerrelationship: $customerrelationship,
      qualitycontrol: $qualitycontrol,
      orientation: $orientation,
      lasttender: $lasttender,
      competitor: $competitor,
      evaluationcommittee: $evaluationcommittee,
      sampledelivery: $sampledelivery,
      precautions: $precautions,
      guidance: $guidance,
      tenderform: $tenderform,
      others: $others,
      createUid: $createUid,
      createDate: $createDate,
      writeUid: $writeUid,
      writeDate: $writeDate,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is SaleBidMarketinfo &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          isdesignated == other.isdesignated &&
          interestedbidder == other.interestedbidder &&
          registeredlist == other.registeredlist &&
          customerrelationship == other.customerrelationship &&
          qualitycontrol == other.qualitycontrol &&
          orientation == other.orientation &&
          lasttender == other.lasttender &&
          competitor == other.competitor &&
          evaluationcommittee == other.evaluationcommittee &&
          sampledelivery == other.sampledelivery &&
          precautions == other.precautions &&
          guidance == other.guidance &&
          tenderform == other.tenderform &&
          others == other.others &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate);

  factory SaleBidMarketinfo.fromMap(Map<String, dynamic> map) {
    return new SaleBidMarketinfo(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      projectId: map['project_id'] != false
          ? map['project_id'][0].toString() as String?
          : "",
      isdesignated: map['isdesignated'] != false
          ? map['isdesignated'].toString() as String?
          : "",
      interestedbidder: map['interestedbidder'] != false
          ? map['interestedbidder'].toString() as String?
          : "",
      registeredlist: map['registeredlist'] != false
          ? map['registeredlist'].toString() as String?
          : "",
      customerrelationship: map['customerrelationship'] != false
          ? map['customerrelationship'].toString() as String?
          : "",
      qualitycontrol: map['qualitycontrol'] != false
          ? map['qualitycontrol'].toString() as String?
          : "",
      orientation: map['orientation'] != false
          ? map['orientation'].toString() as String?
          : "",
      lasttender: map['lasttender'] != false
          ? map['lasttender'].toString() as String?
          : "",
      competitor: map['competitor'] != false
          ? map['competitor'].toString() as String?
          : "",
      evaluationcommittee: map['evaluationcommittee'] != false
          ? map['evaluationcommittee'].toString() as String?
          : "",
      sampledelivery: map['sampledelivery'] != false
          ? map['sampledelivery'].toString() as String?
          : "",
      precautions: map['precautions'] != false
          ? map['precautions'].toString() as String?
          : "",
      guidance:
          map['guidance'] != false ? map['guidance'].toString() as String? : "",
      tenderform: map['tenderform'] != false
          ? map['tenderform'].toString() as String?
          : "",
      others: map['others'] != false ? map['others'].toString() as String? : "",
      createUid: map['create_uid'] != false
          ? map['create_uid'].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'isdesignated': this.isdesignated,
      'interestedbidder': this.interestedbidder,
      'registeredlist': this.registeredlist,
      'customerrelationship': this.customerrelationship,
      'qualitycontrol': this.qualitycontrol,
      'orientation': this.orientation,
      'lasttender': this.lasttender,
      'competitor': this.competitor,
      'evaluationcommittee': this.evaluationcommittee,
      'sampledelivery': this.sampledelivery,
      'precautions': this.precautions,
      'guidance': this.guidance,
      'tenderform': this.tenderform,
      'others': this.others,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.projectId != null && this.projectId != '')
        ['project_id', '=', int.parse(this.projectId!)],
    ] as List;
    //if(list.length==0){
    //  list.add(['id','!=',null]);
    //}
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'project_id': int.parse(this.projectId!),
      'isdesignated': this.isdesignated,
      'interestedbidder': this.interestedbidder,
      'registeredlist': this.registeredlist,
      'customerrelationship': this.customerrelationship,
      'qualitycontrol': this.qualitycontrol,
      'orientation': this.orientation,
      'lasttender': this.lasttender,
      'competitor': this.competitor,
      'evaluationcommittee': this.evaluationcommittee,
      'sampledelivery': this.sampledelivery,
      'precautions': this.precautions,
      'guidance': this.guidance,
      'tenderform': this.tenderform,
      'others': this.others,
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
